using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace WindowsGame3
{
 



    public class Game1 : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        //Texture2D rectangle1;
        //Texture2D rectangle2;
        //Texture2D rectangle3;
        //Texture2D rectangle4;
        //Vector2 tandem;
        
        SpriteFont font;
        int randomizer = 1;

        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
        }

        
        protected override void Initialize()
        {
            graphics.PreferredBackBufferHeight = 800;
            graphics.PreferredBackBufferWidth = 600;
            graphics.IsFullScreen = false;
            Window.Title = "Balls";


            base.Initialize();
        }

        
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            font = Content.Load<SpriteFont>("myFont");

            //rectangle1 = new block().CreateRectangle(10, 10, GraphicsDevice);
            //rectangle2 = new block().CreateRectangle(10, 10, GraphicsDevice);
            //rectangle3 = new block().CreateRectangle(10, 10, GraphicsDevice);
            //rectangle4 = new block().CreateRectangle(10, 10, GraphicsDevice);
                        

            // TODO: use this.Content to load your game content here
        }

        
        protected override void UnloadContent()
        {
            // TODO: Unload any non ContentManager content here
        }

        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();

            // TODO: Add your update logic here

            base.Update(gameTime);
        }

      
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            // TODO: Add your drawing code here
            //tandem.X = over;
            //tandem.Y = down;
            spriteBatch.Begin();
            drawBlock();

            //spriteBatch.Draw(rectangle1, tandem, Color.White);
            //spriteBatch.Draw(rectangle2, (new Vector2 (tandem.X + 10, tandem.Y)), Color.Violet);
            //spriteBatch.Draw(rectangle3, (new Vector2 (tandem.X + 20, tandem.Y)), Color.HotPink);
            //spriteBatch.Draw(rectangle4, (new Vector2 (tandem.X + 30, tandem.Y)), Color.Indigo);

            spriteBatch.End();

            base.Draw(gameTime);
        }

        private void drawBlock()
        {
            Texture2D[] rectangle1 = new block2().defineBlock(GraphicsDevice, randomizer, spriteBatch, font);
        }
       

    }
}
